//大客户管理-客户列表-重置密码
App.util.ns('Admin.Supplier.Supplier');
Admin.Supplier.Supplier.ResetPassword = function(dataTable){
    var win = new App.Win({name: 'reset_password', width: '350px'});
    //表单
    var form = new App.Form({items: [
        {type: 'password', name: 'password', title: '新密码', required: true, rule: {
            type: 'str',
            range: [6, 100]
        }},
        {type: 'password', name: 're_password', title: '确认密码', required: true, rule: function(self){
            return self.form.formItems['password'].value() === self.value();
        }},
        {type: 'hidden', name: 'id'}
    ]});
    form.fix(win.contentContainer);
    win.form = form;
    //设置按钮
    win.setBtns([(function(){
        var cancelBtn = $('<a class="btn btn-danger btn-xs m-right-sm">取消</a>');
        cancelBtn.click(function(){
            win.hide();
        });
        return cancelBtn;
    })(), (function(){
        var saveBtn = $('<a class="btn btn-success btn-xs">保存</a>');
        saveBtn.click(function(){
            if(!form.validate()){
                return ;
            }
            dataTable.postData({
                url: 'resetPassword',
                alert: '保存成功！',
                reload: false,
                data: form.getData(),
                after: function(){
                    win.hide();
                }
            });
        });
        return saveBtn;
    })()]);
    win.hide();
    return win;
};